<template>
  <div>
    <div v-if="componentIs('enterprise')" class="mod-config" id="mod-config-id">
      <div v-if="isAuth('ent:paging')" class="div-s" id="div-s-id">
        <el-form :model="params" :label-position="labelPosition" ref="paramsRefs" :inline="true" label-width="70px" class="queryFormed">
          <el-row class="row-s">
            <el-col  :class="{ 'col-center' : isManager }"  :span="6">
              <el-form-item label="信用代码">
                <el-input v-model="params.certificateCode" placeholder="请选择统一社会信用代码" @clear="clearCertificateCode" clearable>
                </el-input>
              </el-form-item>
            </el-col>
            <el-col class="col-center" :span="6">
              <el-form-item label="企业名称">
                <el-input v-model="params.name"  @clear="clearName" placeholder="请输入企业名称" clearable></el-input>
              </el-form-item>
            </el-col>
            <el-col class="col-center" :span="6">
              <el-form-item label="所在区域">
                <el-select v-model="areaSelectValue" placeholder="请选择区域"  @clear="clearArea" @focus="showSelectAreaDialog" clearable no-data-text=" ">
                </el-select>
              </el-form-item>
            </el-col>
            <el-col v-if="isAuth('ent:transfer')" class="col-right" :span="6">
              <el-form-item label="跟进人">
                <el-select v-model="employeeSelectValue" placeholder="请选择部门/人"  @clear="clearEmployee"  @focus="showSelectEmployeeDialog"  clearable no-data-text=" "></el-select>
              </el-form-item>
            </el-col>
            <el-col   :span="6">
              <el-form-item>
                <el-checkbox v-model="params.dealFlag" :true-label='1' :false-label="0" @change="clickSearch">近两年成交</el-checkbox>
                <el-tooltip class="item" effect="dark" :content="getNearlyTwoYear" placement="top">
                  <img style="width: 14px; height: 14px" src="../../../assets/img/icon-question2.png">
                </el-tooltip>
              </el-form-item>
            </el-col>
            <el-col   :span="6" >
              <el-form-item >
                <el-checkbox v-model="params.mainlyFlag" :true-label='1' :false-label="0" @change="clickSearch"><span>近期重点客户</span></el-checkbox>
              </el-form-item>
            </el-col>
            <el-col   :span="6" >
              <el-form-item >
                <el-checkbox v-model="params.unFollowFlag" :true-label='1' :false-label="0" @change="clickSearch"><span>一个月未跟进客户</span></el-checkbox>
              </el-form-item>
              <el-form-item >
                <el-checkbox v-model="params.transferRecentFlag" :true-label='1' :false-label="null" @change="clickSearch"><span>近期转让</span></el-checkbox>
              </el-form-item>
            </el-col>
            <el-col class="col-right" :span="6" :offset="isManager ? 0 : 6">
              <el-form-item class="item-all">
                <el-button class="buttonItem" size="mini" plain @click="clickReset()">重 置</el-button>
                <el-button class="buttonItem" size="mini" type="primary" @click="clickSearch()">搜 索</el-button>
<!--                <el-button v-if="!isUnfold" @click="turnFoldState" type="text">展开<i
                  class="el-icon-arrow-down zhankai"></i></el-button>
                <el-button v-if="isUnfold" @click="turnFoldState" type="text">收起<i class="el-icon-arrow-up zhankai"></i>
                </el-button>-->
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
      </div>
      <div class="div-e" id="div-e-id">
        <div class="div-inquire" id="div-inquire-id">
          <div class="in-t">
            <div class="in-ts"></div>
            <h3>企业成交</h3>
          </div>
          <div  class="div-button">
            <batch-import :type="1" :customerType="1" v-if="isAuth('ent:import')" @refreshData="refreshData" >
            </batch-import>
            <el-button v-if="isAuth('ent:export')" size="mini" type="primary" icon="el-icon-upload2" @click="clickExport">数据导出</el-button>
            <el-button v-if="isAuth('ent:transfer')"  size="mini" type="primary" @click="showSelectEmployeeTransferDialog" :disabled="customerIdList.length <1">批量转让</el-button>
            <el-button  size="mini" type="primary" @click="markMainly" :disabled="customerIdList.length <1">标记重点客户</el-button>
            <el-button  size="mini" type="danger" @click="unmarkMainly" :disabled="customerIdList.length <1">取消标记重点客户</el-button>
            <el-button v-if="isAuth('ent:save')" size="mini" type="primary" icon="el-icon-plus" @click="showAddOrUpdateDialog('enteprise-add-or-update')">新增</el-button>
          </div>
        </div>
        <el-table
          ref="multipleTable"
          border
          :data="tableData"
          :max-height="table.tableHeight"
          :header-cell-style="{background:'#F5F7FA'}"
          :cell-style="{'border-right': 'none','border-left': 'none'}"
          style="width: 100%"
          v-loading="dataListLoading"
          @sort-change="sortChange"
          @selection-change="handleSelectionChange">
          <el-table-column
            fixed
            type="selection"
            width="55">
          </el-table-column>
          <el-table-column
            label="序号"
            type="index"
            width="70"
            align="center"
          fixed>
            <template slot-scope="scope" >
              <div class="importFlagBox" ><img  v-if="scope.row.mainlyFlag === 1" src="../../../assets/img/importCustomer2x.png" alt="重点客户图标"><span class="boxIndex">{{scope.$index + 1}}</span></div>
            </template>
          </el-table-column>
          <el-table-column
          label="客户评级"
          width="80"
          align="center"
          fixed >
            <template slot-scope="scope">
              <span>{{leverTransformer(scope.row.ratingId, scope.row.unNecessaryFlag)}}</span>
            </template>
          </el-table-column>
          <el-table-column
            fixed
            label="公司名称"
            width="280"
            prop="name"
            align="center"
          show-overflow-tooltip>
            <template slot-scope="scope">
              <span :class="[ scope.row.mainlyFlag === 1 ? 'import-color' : scope.row.unFollowFlag === 1 ? 'warning-color': '']">
                {{scope.row.name}}
              </span>
            </template>
          </el-table-column>
<!--          <el-table-column
            fixed
            label="信用代码"
            width="280"
            prop="certificateCode"
            align="center">
            <template slot-scope="scope">
              <span :class="[ scope.row.mainlyFlag === 1 ? 'import-color' : scope.row.unFollowFlag === 1 ? 'warning-color': '']">
                {{scope.row.certificateCode}}
              </span>
            </template>
          </el-table-column>-->
          <el-table-column
            fixed
            prop=""
            label="地区"
            width="100"
            align="center"
          show-overflow-tooltip>
            <template slot-scope="scope">
              <span :class="[ scope.row.mainlyFlag === 1 ? 'import-color' : scope.row.unFollowFlag === 1 ? 'warning-color': '']">
                {{`${scope.row.areaName}`}}
              </span>
            </template>
          </el-table-column>
<!--          <el-table-column
            prop="addressDetail"
            label="详细地址"
            width="220"
            align="center"
            show-overflow-tooltip>
            <template slot-scope="scope">
              <span :class="[ scope.row.mainlyFlag === 1 ? 'import-color' : scope.row.unFollowFlag === 1 ? 'warning-color': '']">
                {{scope.row.addressDetail}}
              </span>
            </template>
          </el-table-column>-->
          <el-table-column
            prop="contactsName"
            label="联系人"
            width="80"
            align="center"
          show-overflow-tooltip>
            <template slot-scope="scope">
              <span :class="[ scope.row.mainlyFlag === 1 ? 'import-color' : scope.row.unFollowFlag === 1 ? 'warning-color': '']">
                {{scope.row.contactsName}}
              </span>
            </template>
          </el-table-column>
          <el-table-column
            prop="contactsPosition"
            label="职务"
            width="80"
            align="center"
          show-overflow-tooltip>
            <template slot-scope="scope">
              <span :class="[ scope.row.mainlyFlag === 1 ? 'import-color' : scope.row.unFollowFlag === 1 ? 'warning-color': '']">
                {{scope.row.contactsPosition}}
              </span>
            </template>
          </el-table-column>
<!--          <el-table-column
            prop="contactsMobile"
            label="联系人电话"
            width="125"
            align="center">
            <template slot-scope="scope">
              <span :class="[ scope.row.mainlyFlag === 1 ? 'import-color' : scope.row.unFollowFlag === 1 ? 'warning-color': '']">
                {{scope.row.contactsMobile}}
              </span>
            </template>
          </el-table-column>-->
          <el-table-column
            prop="lastYearDealFlag"
            :label="`${getThisYear - 1}年成交?`"
            width="135"
            align="center"
            sortable='custom'
          >
            <template slot-scope="scope">
              <span :class="[ scope.row.mainlyFlag === 1 ? 'import-color' : scope.row.unFollowFlag === 1 ? 'warning-color': '']">
                {{scope.row.lastYearDealFlag === 0 ? '否' : '是'}}
              </span>
            </template>
          </el-table-column>

          <el-table-column
            prop="thisYearDealFlag"
            :label="`${getThisYear}年成交?`"
            width="135"
            sortable='custom'
            align="center">
            <template slot-scope="scope">
              <span :class="[ scope.row.mainlyFlag === 1 ? 'import-color' : scope.row.unFollowFlag === 1 ? 'warning-color': '']">
                {{scope.row.thisYearDealFlag === 0 ? '否' : '是'}}
              </span>
            </template>
          </el-table-column>
<!--          <el-table-column
            prop="lastFollow"
            label="最新跟进"
            align="center"
            width="315"
            show-overflow-tooltip>
            <template slot-scope="scope">
              <span :class="[ scope.row.mainlyFlag === 1 ? 'import-color' : scope.row.unFollowFlag === 1 ? 'warning-color': '']">
                {{scope.row.lastFollow}}
              </span>
            </template>
          </el-table-column>-->
<!--          <el-table-column
            prop="remark"
            label="备注"
            width="170"
            align="center">
          </el-table-column>-->
          <el-table-column
            prop=""
            label="合作记录"
            align="center"
            width="170"
            show-overflow-tooltip>
            <template slot-scope="scope">
              <span :class="[ scope.row.mainlyFlag === 1 ? 'import-color' : scope.row.unFollowFlag === 1 ? 'warning-color': '']">
                {{`${scope.row.lastDealTime === null ? '' : scope.row.lastDealTime} ${ scope.row.lastDealCost === null ? '' : '(' + scope.row.lastDealCost + ')'}`}}
              </span>
            </template>
          </el-table-column>
          <el-table-column
            prop="followUserName"
            label="销售"
            width="80"
            align="center"
            sortable='custom'
          show-overflow-tooltip>
            <template slot-scope="scope">
              <span :class="[ scope.row.mainlyFlag === 1 ? 'import-color' : scope.row.unFollowFlag === 1 ? 'warning-color': '']">
                {{scope.row.followUserName}}
              </span>
            </template>
          </el-table-column>
          <el-table-column
          prop="lastFollow"
          label="最新跟进"
          min-width="200"
          align="center"
          show-overflow-tooltip>
          </el-table-column>
          <el-table-column
            prop="transferDates"
            sortable='custom'
            label="转让天数"
            min-width="120"
            align="center"
            show-overflow-tooltip>
            <template slot-scope="scope">
              <span style="color: #F56C6C;">{{scope.row.transferDates}}</span>
            </template>
          </el-table-column>
          <el-table-column
            label="操作"
            align="center"
            min-width="110">
            <template slot-scope="scope">
              <span style="color: #66b1ff;font-size: 12px" @click="showDetails('enterprise-details',scope.row)">跟进</span>
              <span style="color:#E8E8E8;">|</span>
              <el-popover
                placement="bottom"
                :visible-arrow="false"
                popper-class="popper-style">
                <div style="text-align: center; margin: 0; display: flex;flex-direction: column;font-size: 12px">
                  <div v-if="isAuth('ent:transfer')" @click="clickTransferSingle(scope.row)" class="popover-item">转让</div>
                  <div v-if="isAuth('ent:markE') && scope.row.unNecessaryFlag === 0" @click="markELeverReq(scope.row, true)" class="popover-item">设置E类</div>
                  <div v-if="isAuth('ent:cancelMarkE') && scope.row.unNecessaryFlag === 1" @click="markELeverReq(scope.row, false)" class="popover-item">取消E类</div>
                  <div v-if="isAuth('ent:delete')" @click="clickDelete(scope.row)" class="popover-item">删除</div>
                  <!--                  <el-button size="mini" type="text" @click="popoverVisible = false">转让</el-button>
                                    <el-button size="mini" type="text" @click="popoverVisible = false">移除</el-button>-->
                </div>
                <span slot="reference"  style="color: #66b1ff;font-size: 12px">更多<i
                  class="el-icon-arrow-down"></i></span>
              </el-popover>

            </template>
          </el-table-column>
        </el-table>
        <el-pagination
          @size-change="changePageSize"
          @current-change="turnToPage"
          :current-page="queryInfo.pageIndex"
          :page-sizes="[5, 10, 20, 50, 100, 200]"
          :page-size="queryInfo.pageSize "
          layout="total, prev, pager, next, sizes, jumper"
          :total="totalPage"
          id="div-e-paging-id">
        </el-pagination>
      </div>
      <el-dialog
        title=""
        :visible.sync="selectEmployeeDialogVisible"
        top="20vh"
        width="35%">
      <span slot="title">
        选择部门/人
      </span>
        <div style="border: 1px solid #DDDDDD;border-radius: 2px;height: 30vh;overflow: auto;margin: 0 40px 28px 40px;padding: 13px 20px">
          <el-tree :data="employeeTreeList" ref="employeeQueryTreeRefs" :props="defaultProps" @node-click="employeeHandleNodeClick "></el-tree>
        </div>
        <span style="display: flex;justify-content: center;">
        <el-button @click="selectEmployeeDialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="clickSelectEmployeeSearch">确 认</el-button>
      </span>
      </el-dialog>
      <el-dialog
        title=""
        :visible.sync="selectEmployeeTransferDialogVisible"
        top="20vh"
        width="35%"
        @closed="()=>{this.employeeId=null;this.customerIdList=[];this.$refs.multipleTable.clearSelection()}">
      <h3 slot="title">
        选择部门/人
      </h3>
        <div style="border: 1px solid #DDDDDD;border-radius: 2px;height: 30vh;overflow: auto;margin: 0 40px 28px 40px;padding: 13px 20px">
          <el-tree :data="employeeTreeList" ref="employeeTransferTreeRefs" :props="defaultProps" @node-click="employeeTransferHandleNodeClick "></el-tree>
        </div>
        <span style="display: flex;justify-content: center;">
        <el-button @click="selectEmployeeTransferDialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="clickConfirmTransfer">确 认</el-button>
      </span>
      </el-dialog>
      <el-dialog
        title=""
        :visible.sync="selectAreaDialogVisible"
        top="20vh"
        width="35%">
      <span slot="title">
        选择地区
      </span>
        <div style="border: 1px solid #DDDDDD;border-radius: 2px;height: 30vh;overflow: auto;margin: 0 40px 28px 40px;padding: 13px 20px">
          <el-tree :data="areaTreeList" :props="areaTreeProps" @node-click="areaHandleNodeClick" ></el-tree>
        </div>
        <span style="display: flex;justify-content: center;">
        <el-button @click="selectAreaDialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="clickSelectAreaSearch">确 认</el-button>
      </span>
      </el-dialog>
    </div>
    <enteprise-add-or-update v-if="componentIs('enteprise-add-or-update')"  :isAdd="true"></enteprise-add-or-update>
    <enterprise-details v-if="componentIs('enterprise-details')" :id="customerId"></enterprise-details>
    <income-detail></income-detail>
  </div>
</template>

<script>
import BasePaging from '../../common/BasePaging'
import {isAuth, leverTransformer} from '../../../utils'
import { getUserInfo } from '../../../api/sys'
import { getDepartTree } from '../../../api/depart'
import EntepriseAddOrUpdate from './entetpriseComponent/enteprise-add-or-update'
import EnterpriseDetails from './entetpriseComponent/enterprise-details'
import {
  getAreaTree,
  paging
} from '../../../api/customer/potential'
import BatchImport from './Component/BatchImport'
import {
  customerExport,
  markMainly,
  unmarkMainly,
  transferCustomerBatch
} from '../../../api/customer/enterprise'
import IncomeDetail from './Component/IncomeDetail'
import {deleteCustomer} from '../../../api/customer/regionalList'
import {markELever} from '../../../api/customer/commom'
const isObjHasKey = require('lodash/has')
export default {
  name: 'enterprise',
  components: {IncomeDetail, BatchImport, EnterpriseDetails, EntepriseAddOrUpdate},
  extends: BasePaging,
  created () {
    this.getUserInfo()
    if (isAuth('ent:paging')) { this.paging() }
  },
  data () {
    return {
      bodyHeight: 0,
      searchHeight: 0,
      userInfo: {},
      inqerts: false,
      isAdd: true,
      customerId: '',
      employeeId: '',
      params: {
        followUserId: '',
        name: '',
        cityId: '',
        areaId: '',
        certificateCode: '',
        dealFlag: 0,
        mainlyFlag: 0,
        unFollowFlag: 0,
        employeeId: '',
        deptId: '',
        transferRecentFlag: null
      },
      labelPosition: 'left',
      componentFlag: 'enterprise',
      employeeSelectValue: '',
      areaSelectValue: '',
      dataListLoading: false,
      selectEmployeeDialogVisible: false,
      selectAreaDialogVisible: false,
      addOrUpdateVisible: false,
      selectEmployeeTransferDialogVisible: false,
      tableData: [],
      employeeTreeList: [],
      areaTreeList: [],
      customerIdList: [],
      defaultProps: {
        children: 'children',
        label: 'name'
      },
      areaTreeProps: {
        children: 'children',
        label: 'name'
      }
    }
  },

  methods: {
    mountedHandle () {
      this.getOtherHeight()
    },
    isAuth (auth) {
      return isAuth(auth)
    },
    refreshData () {
      this.initParams()
      this.paging()
    },
    paging () {
      this.dataListLoading = true
      paging(
      '/ent/customer/paging',
        {
          'conditions': {
            'typeId': 1,
            'enterpriseFlag': 1,
            'followUserId': this.params.employeeId,
            'name': this.params.name,
            'cityId': this.params.cityId,
            'areaId': this.params.areaId,
            'certificateCode': this.params.certificateCode,
            'dealFlag': this.params.dealFlag,
            'mainlyFlag': this.params.mainlyFlag,
            'unFollowFlag': this.params.unFollowFlag,
            'deptId': this.params.deptId,
            'transferRecentFlag': this.params.transferRecentFlag
          },
          'inOrder': this.inOrder,
          'orderBy': this.orderBy,
          'pageNum': this.queryInfo.pageIndex,
          'pageSize': this.queryInfo.pageSize
        },
        'post',
        (data) => {
          this.tableData = data.data.records
          this.totalPage = data.data.total
          this.dataListLoading = false
        }
      )
    },
    // 初始化搜索参数
    initParams () {
      this.params.dealFlag = 0
      this.params.mainlyFlag = 0
      this.params.unFollowFlag = 0
      this.employeeSelectValue = ''
      this.areaSelectValue = ''
      Object.keys(this.params).forEach((key) => { this.params[key] = '' })
    },
    // 判断当前什么组件
    componentIs (val) {
      return this.componentFlag === val
    },
    // 更改组件显示
    changeComponent (to) {
      this.componentFlag = to
      this.paging()
    },
    handleSelectionChange (selection) {
      // console.log('selection', selection)
      this.customerIdList = selection.map(item => item.id)
    },
    showAddOrUpdateDialog (val) {
      this.changeComponent(val)
    },
    showDetails (val, row) {
      this.changeComponent(val)
      this.customerId = row.id
    },
    // 点击搜索
/*    clickSearch () {
      this.paging()
    }, */
    // 点击重置
    clickReset () {
      this.initParams()
      this.paging()
    },
    getUserInfo () {
      getUserInfo(
        (data) => {
          this.userInfo = data.user
        }
      )
    },
    // action 为使用超场景 1为客户转让 2为客户搜索
    getEmployeeTree (action = 2) {
      getDepartTree(
        action,
        (data) => {
          this.transformEmployeeTreeData(data.data)
          this.employeeTreeList = data.data
        }
      )
    },
    showSelectEmployeeDialog () {
      this.getEmployeeTree(2)
      this.selectEmployeeDialogVisible = true
    },
    // 部门人员数据转换为符合组件使用的类型
    transformEmployeeTreeData (data = []) {
      if (data) {
        // debugger
        data.forEach((item) => {
          item.name = item.deptName
          if (item.children && item.userList) {
            this.transformEmployeeTreeData(item.children)
            item.children = item.children.concat(item.userList)
          } else if (!item.children && item.userList) {
            item.children = item.userList
          }
        })
      }
    },
    // 清空
    clearEmployee () {
      this.params.employeeId = ''
      this.clickSearch()
    },
    clearArea () {
      this.params.areaId = ''
      this.params.cityId = ''
      this.clickSearch()
    },
    clearName () {
      this.params.name = ''
      this.clickSearch()
    },
    clearCertificateCode () {
      this.params.certificateCode = ''
      this.clickSearch()
    },

    // 选择部门对话框
    employeeHandleNodeClick (nodeObj, node) {
      // console.log('node', node)
      this.employeeSelectValue = node.data.name
      if (node.isLeaf) {
        this.params.deptId = null
        this.params.employeeId = node.data.id
      } else {
        this.params.employeeId = null
        this.params.deptId = node.data.id
      }
    },
    // 选择区域对话框
    areaHandleNodeClick (nodeObj, node) {
      this.areaSelectValue = node.data.name
      if (node.isLeaf) {
        this.params.cityId = ''
        this.params.areaId = node.data.id
      } else {
        this.params.areaId = ''
        this.params.cityId = node.data.id
      }
    },
    showSelectAreaDialog () {
      getAreaTree(
        '/ent/area/tree',
        {'actionId': 1},
        'post',
        (data) => {
          this.areaTreeList = data.data
        }
      )
      this.selectAreaDialogVisible = true
    },
    // 确认转让
    clickConfirmTransfer () {
      console.log('node', this.$refs.employeeTransferTreeRefs.getCurrentNode())
      let curNode = this.$refs.employeeTransferTreeRefs.getCurrentNode()
      if (this.customerIdList && this.employeeId) {
        // 用来判断选择是否是部门
        let isDept = isObjHasKey(curNode, 'userList')
        if (!isDept) {
          this.$prompt('请输入转让日志', '提示', {
            confirmButtonText: '确认',
            cancelButtonText: '取消',
            closeOnClickModal: false,
            inputValidator: function (value) {
              if (!value) {
                return '转让日志不得为空!'
              } else if (value.length < 20 && value.length > 0) {
                let currlen = value.length
                return `日志长度至少为20字,当前长度为${currlen}`
              } else {
                return true
              }
            }
          }).then(({value}) => {
            transferCustomerBatch({customerIdList: this.customerIdList, userId: this.employeeId, remark: value},
              () => {
                this.$message.success('转让成功!')
                this.paging()
              })
            this.selectEmployeeTransferDialogVisible = false
          })
        } else {
          this.$message.warning('只能转让给部门下的人员，重新选择。')
        }
      } else {
        this.selectEmployeeTransferDialogVisible = false
      }
    },
    employeeTransferHandleNodeClick (node) {
      // console.log('ndoe', node)
      this.employeeId = node.id
    },
    // 标记重点客户
    markMainly () {
      markMainly(this.customerIdList, () => { this.paging() })
    },

    // 取消标记重点客户
    unmarkMainly () {
      unmarkMainly(this.customerIdList, () => { this.paging() })
    },
    markELeverReq (row, flag) {
      let dataForm = {}
      if (row) {
        dataForm['idList'] = row.id ? [row.id] : []
        // 1用于标识E标记
        dataForm['typeId'] = 1
        dataForm['flag'] = flag
      }
      markELever(dataForm, () => { this.paging() })
    },
    // 显示批量转让对话框
    showSelectEmployeeTransferDialog () {
      this.getEmployeeTree(1)
      this.selectEmployeeTransferDialogVisible = true
    },
    // 单条转让
    clickTransferSingle (row) {
      this.customerIdList = []
      this.customerIdList.push(row.id)
      this.showSelectEmployeeTransferDialog()
    },
    // 点击删除客户
    clickDelete (row) {
      this.$confirm(`确定要删除“${row.name}”吗？`, '提示', {
        confirmButtonText: '确 认',
        cancelButtonText: '取 消',
        type: 'warning'
      }).then(() => {
        // removeCustomer(row.id)
        deleteCustomer(row.id, () => { this.paging() })
        this.paging()
      })
    },
    // 批量导入
    importBatch () {

    },
    clickExport () {
      customerExport({ 'typeId': 1,
        'enterpriseFlag': 1,
        ...this.params}, '企业成交客户.xls')
    },
    // 把表格固定行添加右分隔线
    cellStyle ({row, column, rowIndex, columnIndex}) {
      console.log('columnIndex', columnIndex)
      if (columnIndex === 3) {
        return 'borderLeft:2px solid #6E92E9'
      } else {
        return ''
      }
    },
    clickSelectAreaSearch () {
      this.clickSearch()
      this.selectAreaDialogVisible = false
    },
    clickSelectEmployeeSearch () {
      this.clickSearch()
      this.selectEmployeeDialogVisible = false
    },
    leverTransformer (leverId, isEMark) {
      return leverTransformer(leverId, isEMark)
    },
/*    tableRowClick (row, clo, event) {
     // console.log('row', row)
     // console.log('clo', clo)
     // console.log('event', event)
      let tableRefs = this.$refs.multipleTable
      let findRowId = this.customerIdList.find((id) => id === row.id)
     // console.log('findRowId', findRowId)
      if (findRowId) {
        tableRefs.toggleRowSelection(row, false)
        return
      }
      tableRefs.toggleRowSelection(row, true)
    } */
  },
  computed: {
    isManager () {
      return this.userInfo.managerFlag === 1
    },
    getThisYear () {
      return new Date().getFullYear()
    },
    getNearlyTwoYear () {
      return (new Date().getFullYear() - 1) + '.1.1'
    }
  }

}
</script>
